def window(seq, n):
    """
    Return a segment of the sequence, seq, of
    length, n. 
    seq - sequence
    n - size of window
    return generator
    """
    for i in range(0,len(seq), n):
        yield seq[range(i,i+n)]
